package com.netease.spring.advice;

import com.netease.spring.exceptions.CustomerIsBrokeException;
import com.netease.spring.exceptions.KwikEMartException;
import com.netease.spring.exceptions.NoMoreSquisheeException;

public class ApuKwikEMart implements KwikEMart {

	private boolean squisheeMachineEmpty = false;
	
	@Override
	public Squishee buySquishee(Customer customer) throws KwikEMartException {
		if(customer.isBroke()) {
			throw new CustomerIsBrokeException();
		}
		if(squisheeMachineEmpty) {
			throw new NoMoreSquisheeException();
		}
		return new Squishee();
	}

	@Override
	public void setMachine(boolean isEmpty) {
		// TODO Auto-generated method stub
		squisheeMachineEmpty = isEmpty;
	}

}
